# -*- encoding=utf8 -*-
__author__ = "86181"

from airtest.core.api import *

auto_setup(__file__)


phone_name = "BA85HIBMJJMFFED6"
collar_name = "DH01DF3A310006"


def get_window_bar():      
    try:
        print("转至手机INAIR App")
        ST.SAVE_IMAGE = False
        phone = connect_device(f"Android://127.0.0.1:5037/{phone_name}") 
        width, height = phone.get_current_resolution()
        set_current(phone_name)        
        for i in range(5):
            phone.swipe((width/2, height/2),((width/2)-300,(height/2)-280))
        sleep(1)
        for i in range(3):
            phone.swipe((width/2, height/2),((width/2)+100,(height/2)))            
        sleep(1)        
        for i in range(2):
            phone.swipe((width/2, height/2),((width/2),(height/2)+120))  
        sleep(5)
        for i in range(40):
            phone.swipe((width/2, height/2),((width/2)+50,(height/2)))            
            sleep(1)
            phone.swipe(((width/2)+50,(height/2)),(width/2, height/2))            
            
#         collar = connect_device(f"Android://127.0.0.1:5037/{collar_name}") 
#         set_current(collar_name)        
#         touch(Template(r"tpl1701155808300.png", record_pos=(0.099, -0.244), resolution=(1920, 1200)))
    except:pass
    
while 1:
    get_window_bar()






